package v1

import (
    "authserver/constants"
    "authserver/global/response"
    "authserver/model"
    "authserver/service"
    "github.com/gin-gonic/gin"
    "time"
)

// AddXyRecord @Tags xy_record
// @Summary
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.AppletLogin true "游客登录"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /xy/addLog [post]
func AddXyRecord(c *gin.Context) {

    param:= model.XyRecord{
        ClientIp: c.ClientIP(),
        RecordTime: time.Now().Format(constants.DayTime),
    }

    err := service.AddXyRecord(param)
    if err != nil {
        response.FailWithMessage(err.Error(), c)
    } else {
        response.OkWithMessage("ok",c)
    }
}

// GetXyLogSta @Tags xy_record
// @Summary
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.AppletLogin true "游客登录"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /xy/getLogSta [get]
func GetXyLogSta(c *gin.Context) {

    sta := service.GetXyRecordSta()
    response.OkWithData(sta,c)
}


